import re
from playwright.sync_api import Playwright, sync_playwright, expect
def run(playwright: Playwright) -> None:
    browser = playwright.chromium.launch(headless=False)
    context = browser.new_context()
    page = context.new_page()
    page.goto("http://localhost:90/")
    page.get_by_role("textbox", name="请输入您的用户名").click()
    page.get_by_role("textbox", name="请输入您的用户名").fill("admin")
    page.get_by_role("textbox", name="请输入密码").click()
    page.get_by_role("textbox", name="请输入密码").fill("123456")
    page.get_by_role("textbox", name="请输入密码").press("Enter")
    page.get_by_role("link", name=" 理财产品管理 ").click()
    page.get_by_role("link", name="零钱理财").click()
    page.get_by_role("link", name="期限理财").click()
    for i in range(100):
        page.get_by_role("button", name="新增").click()
        page.get_by_role("textbox", name="请输入期限理财产品名称：").click()
        page.get_by_role("textbox", name="请输入期限理财产品名称：").fill("11")
        page.get_by_role("textbox", name="请输入起投金额：").click()
        page.get_by_role("textbox", name="请输入起投金额：").fill("1")
        page.get_by_role("textbox", name="日收益率：").click()
        page.get_by_role("textbox", name="日收益率：").fill("1")
        page.locator("#investerm_add_input").click()
        page.locator("#investerm_add_input").fill("1")
        page.locator("#income_add_input").dblclick()
        page.locator("#income_add_input").fill("1")
        page.get_by_role("button", name="保存").click()
    # ---------------------
    context.close()
    browser.close()
with sync_playwright() as playwright:
    run(playwright)
